package main;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Tracker {
	
	private final ConcurrentHashMap<String, Point> map;
	
	public Tracker(){
		this(new ConcurrentHashMap<String, Point>());
	}
	
	public Tracker(ConcurrentHashMap<String, Point> map){
		this.map = new ConcurrentHashMap<String, Point>(map);
	}
	
	
	public Point get(String address){
		return map.get(address);
	}
	
	public Point set(String address, Point point){
		return map.putIfAbsent(address, point);
	}
	
	public Map<String, Point> getAll(){
		return new ConcurrentHashMap<String, Point>(map);
	}
	
	public static class Point{
		public final int x;
		public final int y;
		
		public Point(int x, int y){
			this.x = x;
			this.y = y;
		}
	}
}
